<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html   xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Registration page</title>
    </h:head>
    <h:body>
          <h:form>
            <p:messages id="messages" 
                        showDetail="true" 
                        autoUpdate="true" 
                        closable="true" />
            <h:panelGrid columns="3" cellpadding="5">
                <p:outputLabel for="login" 
                               value="#{bundle.login}: " />
                <p:inputText id="login" 
                             value="#{registrationPageController.login}"
                             required="true">
                    <f:validateLength minimum="3" maximum="30"/>
                    <f:validateRegex pattern="^([a-zA-Z0-9]{3,30})$"/>
                </p:inputText>
                <h:message for="login"/>
          
                <p:outputLabel for="password" 
                               value="#{bundle.password}: " />
                <p:password id="password" 
                             value="#{registrationPageController.password}"
                             required="true">
                    <f:validateLength minimum="3" maximum="30"/>
                </p:password>
                <h:message for="password"/>
          
                <p:outputLabel for="passwordConf" 
                               value="#{bundle.password_confirm}: " />
                <p:password id="passwordConf" 
                       value="#{registrationPageController.passwordConfirm}"
                       required="true">
                    <f:validateLength minimum="3" maximum="30"/>
                </p:password>
                <h:message for="passwordConf"/>
                
                <p:outputLabel for="name" 
                               value="#{bundle.name}: " />
                <p:inputText id="name" 
                             value="#{registrationPageController.name}"
                             required="true">
                    <f:validateLength minimum="1" maximum="30"/>
                </p:inputText>
                <h:message for="name"/>
                
                 <p:outputLabel for="surname" 
                               value="#{bundle.surname}: " />
                <p:inputText id="surname" 
                             value="#{registrationPageController.surname}"
                             required="true">
                    <f:validateLength minimum="1" maximum="30"/>
                </p:inputText>
                <h:message for="surname"/>
 
                <p:outputLabel for="birthCalendar" 
                               value="#{bundle.birth_date}"/>
                <p:calendar id="birthCalendar" 
                            value ="#{registrationPageController.birthDate}" 
                            required="true"
                            navigator="true"
                            yearRange="1930:1994">
                    
                    <p:ajax event ="dateSelect"/>
                </p:calendar>
                <h:message for="birthCalendar"/>
                
                <p:outputLabel for="gender" value="#{bundle.gender}"/>
                <p:selectOneMenu id="gender" 
                                 value="#{registrationPageController.gender}"
                                 required="true">
                    <f:selectItem itemLabel="#{bundle.male}" 
                                  itemValue="#{bundle.male}"/>
                    <f:selectItem itemLabel="#{bundle.female}" 
                                  itemValue="#{bundle.female}"/>
                    <f:selectItem itemLabel="#{bundle.other}" 
                                  itemValue="#{bundle.other}"/>
                </p:selectOneMenu>
                <h:message for="gender"/>
                
                <p:outputLabel for="phone" value="#{bundle.phone}: " />
                <p:inputMask id="phone" 
                       value="#{registrationPageController.telephone}" 
                       required="true"
                       mask="(999) 999-9999">
                </p:inputMask>
                <h:message for="phone"/>
          
                <p:outputLabel for="email" value="#{bundle.email}: " />
                <p:inputText id="email" 
                       value="#{registrationPageController.email}"
                       required="true">
                    <f:validateRegex 
                        pattern="^[_a-z0-9]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[_a-z0-9-]+)*(\.[a-z]{2,4})$"/>
                </p:inputText>
                <h:message for="email"/>
                
                
                
            </h:panelGrid>
            <h:panelGrid>
                 <p:commandButton id="registrationButton" 
                      value="#{bundle.registration_button}"
                      action="#{registrationPageController.registerUser()}"/>
            </h:panelGrid>
          </h:form>
    </h:body>
</html>

